<include file="__THEME__/common/header" />
<script language="javascript">
$(function(){
	var updateurl = '{:U("Attribute/editattr")}';
	var detailurl = '{:U("Attribute/attrvaluelist")}';
	$('#datagrid').datagrid({
		url : '{:U("Attribute/attributelist")}&type=2&id={$groupid}&d='+Math.random(),
		title: '<span class="color-red">{$attrname}</span> - 属性列表',
		width: '100%',
		pagination : true,
		idField: 'id',
		columns: [[
			{title:'ID', field:'id', width:50, sortable:true, checkbox:true},
			{title:'属性名称', field:'name', width:100, sortable: true, formatter:function(v,r){
				return "<a href='"+detailurl+"&id="+r.id+"'>"+v+"</a>";
			}},
			{title:'添加时间', field:'add_time', width: 100, align:'left'},
			{title:'状态', field:'status', width:50, align:'left'},
			{title:'排序', field:'sort', width:50, sortable:true},
			{title:'备注', field:'remark', width: 150},
			{title:'操作', field:'opt', width:200, align:'left', formatter:function(v, r){
				return '<div class="opt"><a href="'+detailurl+'&id='+r.id+'" class="view">属性值</a><a href="'+updateurl+'&id='+r.id+'" class="edit">编辑</a><a href="javascript:;" onclick="doDelete('+r.id+')" class="delete">删除</a></div>';
			}}
		]]
	});
});
function doDelete(id){
	$.messager.confirm('提示', '确定删除该属性组吗？', function(r){
		if (r){
			$.ajax({
				url : '{:U("Attribute/deleteattribute")}',
				data : 'id='+id,
				dataType: 'json',
				success : function(d){
					if(d.status == 0){
						alertText(d.info, 'error');
					}else{
						$('#datagrid').datagrid('reload');
					}
				}
			});
		}
	});
}
</script>
<div class="box">
<table id="datagrid"></table>
</div>
<include file="__THEME__/common/footer" />